﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Report8FTrade.aspx.cs" Inherits="IHISCETeim.Web.MachineSys.FTradeModel.Report8FTrade" %>

<%--6.分期逾期表--%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../EasyUI/themes/default/easyui.css"/>
	<link rel="stylesheet" type="text/css" href="../EasyUI/themes/icon.css" />
	<script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script>   
	<script type="text/javascript" src="../EasyUI/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../EasyUI/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="../EasyUI/easyui-formatter_20140718.js"></script>
     <link href="../themes/css/jquery.autocomplete.css" rel="stylesheet" type="text/css" />
    <script src="../js/DWZ/jquery.autocomplete.js" type="text/javascript"></script>

    <script type="text/javascript">
        $(window).resize(function(){		    
             $("#dg").datagrid({
                    width: '100%',
                    height: $(parent.document).find(".tabsPageContent").height() - 11 > 0 ? $(parent.document).find(".tabsPageContent").height() - 11 : 500,
             }); 
	    });
        //权限处理
        var $powers={
            "r查看":<%=HasPowerEasyUI(IHISCETeim.Web.Permission.查看) %> 
        };

        $(document).ready(function () {
            var $tab_toolbar=$("#tab_toolbar");
            $tab_toolbar.find("a").each(function(){
                var $per=$(this).attr("Permission");
                var pt= $powers[$per]==undefined || null?true:$powers[$per];
                $(this).linkbutton(pt?'enable': 'disable');
            })
           
            //加载数据
            InitGird();           
        })
        //加载列表数据
        function InitGird() {
            $('#dg').datagrid({    
                title:"分期汇总表(短期分期，置换，首付代垫）",       
                url: location.href, //请求数据的页面
                sortName: 'JingXiaoShang', //排序字段
                sortOrder: 'desc', //排序类型
                iconCls: '', //标题左边的图标
                idField: 'JingXiaoShang', //标识字段,主键
                width: '100%', //宽度    
                height: $(parent.document).find(".tabsPageContent").height() - 11 > 0 ? $(parent.document).find(".tabsPageContent").height() - 11 : 500,
                nowrap: false, //是否换行，True 就会把数据显示在一行里
                striped: true, //True 奇偶行使用不同背景色
                collapsible: false, //可折叠
               
                singleSelect: true, //是否只能选中一条
                remoteSort: true, //定义是否从服务器给数据排序
                frozenColumns: [[//冻结的列，不会随横向滚动轴移动
                    {title:'经销商',field:'经销商',width: 100,sortable:true,formatter:function(value, row, index){
                         if(value==undefined)
                                return "合计:";
                        return '<a href="#"  title="查看分期明细信息" onclick="onViewDetailClick(\''+value+'\'); return false;">'+value+'</a>';//事件处理
                        //return value;
                    }},                	
                  
				]],
                columns: [[
                      { title: '总额', field: '总额', width:100,formatter:milliformatter},
                    { title: '<%=DateTime.Now.ToString("yyyy-MM") %>前未付首付', field: '首付逾期上月前', width:120,formatter:function(value, row, index){
                        if(row.经销商==undefined)
                            return milliformatter(value,2);
                        return "<a href='#' onclick=\"onCellClick('"+row.经销商+"')\" >"+milliformatter(value,2)+"</a>"
                    }},
                    { title: '<%=DateTime.Now.ToString("yyyy-MM") %>前其它未付', field: '分期逾期上月前', width:120,formatter:function(value, row, index){
                        if(row.经销商==undefined)
                            return milliformatter(value,2);
                        return "<a href='#' onclick=\"onOthenCellClick('"+row.经销商+"')\" >"+milliformatter(value,2)+"</a>"
                    }},
                    { title: '<%=DateTime.Now.ToString("yyyy-MM") %>前未付', field: '分期逾期上月前所有', width:120,formatter:milliformatter},
                     <%=GetGirdColumns() %>    
                ]],
                toolbar: "#tab_toolbar",
                queryParams: { "action": "query" },
                pagination: false, //是否开启分页
                pageNumber: 1, //默认索引页
                pageSize: <%=numPerPage %>, //默认一页数据条数
                pageList:<%=SetnumPerPage() %>,
                rownumbers: true, //行号
                showFooter: true,
                onHeaderContextMenu: function(e, field){
					e.preventDefault();
					if (!$('#tmenu').length){
						createColumnMenu();
					}
					$('#tmenu').menu('show', {
						left:e.pageX,
						top:e.pageY
					});
				},
                onRowContextMenu:function(e,rowIndex,rowData)
                {
                    e.preventDefault();
					if (!$('#tmenu').length){
						createColumnMenu();
					}
					$('#tmenu').menu('show', {
						left:e.pageX,
						top:e.pageY
					});
                }
            });

        }       
       
        /*列表头部*/
      // var ColumnFields={'JingXiaoShang':"经销商",'WeiShouKuanXiang':"应收帐款总额",'融资租赁未放款':"融资租赁(未放款)",'融资租赁已放款':"融资租赁(已放款)",'分期':"分期",'全款':"全款",'按揭':"按揭",'库存':"库存","逾期30天内":"逾期30天内","逾期90天":"逾期31-90天","逾期180天":"逾期91-180天","逾期180天以上":"逾期180天以上"};
       function createColumnMenu(){
			var tmenu = $('<div id="tmenu" style="width:150px;"></div>').appendTo('body');
			var fields = $('#dg').datagrid('getColumnFields');
			for(var i=0; i<fields.length; i++){
				$('<div data-options="name:\''+fields[i]+'\',iconCls:\'icon-ok\'" />').html($('#dg').datagrid('getColumnOption',fields[i]).title).appendTo(tmenu);
			}
			tmenu.menu({
				onClick: function(item){
					if (item.iconCls=='icon-ok'){                       
						$('#dg').datagrid('hideColumn', item.name);
						tmenu.menu('setIcon', {
							target: item.target,
							iconCls: 'icon-empty'
						});
					} else {
						$('#dg').datagrid('showColumn', item.name);
						tmenu.menu('setIcon', {
							target: item.target,
							iconCls: 'icon-ok'
						});
					}
				}
			});
		}
        
    </script>
    <script>
        //操作功能JS
        function onViewDetailClick(agentname) {
            var rel = "ReportZhanLin1Detail";
            var url = "FTradeModel/ReportZhanLin1EasyUI.aspx?IsShowFenQi=1&JingXiaoShang=" +  encodeURI(agentname);
            var title = "查看[" + agentname + "]分期明细";
            var options = { width: 850, height: 450, max: false, mask: true, maxable: false, minable: false, fresh: true, resizable: false, drawable: true };
            //top.$.pdialog.open(url, rel, title, options);
            top.navTab.openTab(rel, url, { title: title, fresh: true, external: true });
            return false;
        }
        function onCellClick(jsx)
        {
            //alert(jsx);
            var rel = "Report8FTradeDetail";
            var url = "FTradeModel/Report8FTradeDetail.aspx?IsShowFenQi=1&JingXiaoShang=" +  encodeURI(jsx);
            var title = "查看[" + jsx + "]<%=DateTime.Now.ToString("yyyy-MM") %>前未付分期首付明细";
            var options = { width: 850, height: 450, max: false, mask: true, maxable: false, minable: false, fresh: true, resizable: false, drawable: true };
            //top.$.pdialog.open(url, rel, title, options);
            top.navTab.openTab(rel, url, { title: title, fresh: true, external: true });
            return false;
        }

        function onOthenCellClick(jsx)
        {
           // alert(jsx);
            var rel = "Report8FTradeDetail_OtherWeiFu";
            var url = "FTradeModel/Report8FTradeDetail_OtherWeiFu.aspx?IsShowFenQi=1&JingXiaoShang=" +  encodeURI(jsx);
            var title = "查看[" + jsx + "]<%=DateTime.Now.ToString("yyyy-MM") %>前其它分期未付明细";
            var options = { width: 850, height: 450, max: false, mask: true, maxable: false, minable: false, fresh: true, resizable: false, drawable: true };
            //top.$.pdialog.open(url, rel, title, options);
            top.navTab.openTab(rel, url, { title: title, fresh: true, external: true });
            return false;
        }
        //导出管控表
        function onExportList() {

            var href = "<%= ExportExcelWebUrl%>/FTradeModel/FTradeExportReport8.aspx?uid=<%=User.UserId %>";
            top.window.open(href, "");
            return false;
            return false;
        }
       

    </script>
</head>
<body style="margin:1px;" >
    <div id="dg">
        
    </div>
    <div id="tab_toolbar" style="padding:2px;">  
       <span style="line-height:26px;width:60px; font-weight:bold; color:Red; "><%=base.GetLastUpdate("FTradeCatheringListEasyUI,FTradeReceivablesListEasyUI") %></span>
       <a href="#"  class="easyui-linkbutton" iconcls="icon-btnDown" plain="true" onclick="return onExportList();" Permission="r导出">导出</a>
    </div>   

     
</body>
</html>
